# encoding: utf-8
# @project: st2111 
# @file: selenium_example8.py
# @time: 2023/6/1 14:53
# @author: abcque
# @license: (C) Copyright 2013-2021
# @contact: abcque@outlook.com
# @IDE: PyCharm
# @desc:
import time

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

if __name__ == "__main__":
    url = "https://www.taobao.com"
    executable_path = "../drivers/chromedriver.exe"

    service = Service(executable_path=executable_path)
    brower = webdriver.Chrome(service=service)

    brower.get(url=url)

    # 查找多个元素
    element = brower.find_element(by=By.ID, value="q")

    # print(element)
    # 获取元素的属性值，并返回。
    name = element.get_property("name")
    print(name)

    id = element.get_property(name="id")
    print(id)

    time.sleep(5)
    brower.quit()
